package com.example.aerospacemanagementsystem.controller.attendance;


import com.example.aerospacemanagementsystem.entity.attendance.Travel;

import com.example.aerospacemanagementsystem.service.attendanceService.TravelService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
/**
 * @author 李明国
 */
@Api(tags = "出差")
@RestController
@CrossOrigin
@RequestMapping("/Travel")
public class TravelControllrer {
    @Autowired
    private TravelService travelService;
    //添加出差
    @PostMapping
    public int add(@RequestBody Travel travel){
        return travelService.add(travel);
    }
    //删除出差
    @DeleteMapping
    public int delete(Travel travel){
        return travelService.delete(travel);
    }
    //修改出差
    @PutMapping
    public int update(@RequestBody Travel travel){ return travelService.update(travel);
    }
    //获取出差
    @GetMapping("/getAll")
    public List<Travel> getAllCity(Travel travel) {
        List<Travel> list = travelService.getAllTravel(travel);
        return list;
    }
}
